
#@homejs()
#@checkToken2()
<div style="width:880px;min-height:550px;"> 
	<!--第一栏-->
	<div style="width:880px;height:200px;background:#FFF">
		<div style="float:left;width:300px;">
			<div><img style="width:80px;margin-top:20px;" src="#(path)/assets/home/account/account_img5.png"></div>
			<div style="margin-top:10px;">您好，<span id="mobile"></span>！</div>
			<div style="margin-top:10px;">
				<img id="is_real_name_verify" style="margin-right:10px;cursor:pointer;" src="#(path)/assets/home/account/account_img6.png">
				<img id="is_real_mobile" style="margin-right:10px;cursor:pointer;" src="#(path)/assets/home/account/account_img7.png">
				<img id="is_set_auth_question" style="margin-right:10px;cursor:pointer;" src="#(path)/assets/home/account/account_img8.png">
				<img id="is_bind_bank_card" style="margin-right:10px;cursor:pointer;" src="#(path)/assets/home/account/account_img9.png">
				<img id="is_password" style="margin-right:10px;cursor:pointer;" src="#(path)/assets/home/account/account_img10.png">
				<img id="is_mail_verify" style="margin-right:10px;cursor:pointer;" src="#(path)/assets/home/account/account_img11.png">
			</div>
		</div>
		<div style="float:left;width:540px;padding:20px;">
			<div align="left" style="width:480px;height:120px;background:#fff8f5;padding:20px;">
				<div><span style="color:#5d5d5d;font-size:16px;">账户余额</span></div>
				<div style="color:#fa4357;border-bottom:1px solid #e9e5e2">
					<span id="availableAmount" style="font-size:28px;font-weight:400"></span>
					<span style="font-size:16px;">元</span>
					<span id="withdrawbt" style="cursor:pointer;float:right;padding:4px 20px;border:1px solid #fa4357;border-radius:6px;">提现</span>
					<span class="rechargebt" style="cursor:pointer;float:right;margin-right:10px;color:#fff;border:1px solid #fa4357;padding:4px 20px;background:#fa4357;border-radius:6px;">充值</span>
				</div>
				<div style="padding-top:20px;">  
					<div style="float:left;width:280px;color:#5f5f5f">
						<img style="float:left;margin-right:10px;" src="#(path)/assets/home/account/account_img12.png">
						<div style="float:left;">
							<div style="font-size:14px;">资产总额</div>
							<div id="all_assets" style="font-size:20px;"></div>  
						</div>
					</div>
					<div style="float:left;width:200px;">
						<img style="float:left;margin-right:10px;" src="#(path)/assets/home/account/account_img13.png">
						<div style="float:left;">
							<div style="font-size:14px;">冻结金额</div>
							<div id="freezebleAmount" style="font-size:20px;"></div>
						</div>
					</div>
					
				</div>
			</div>
		</div>
	</div>
	<!--第二栏-->
	<div align="center" style="padding:25px;width:830px;height:180px;margin-top:20px;background:#FFF">
		<div style="width:700px;border-bottom:1px solid #e0e0e0;height:90px;">
			<div style="float:left;width:230px;color:#5f5f5f">
				<div style="font-size:18px;">余额收益</div>
				<div style="margin-top:10px;">
				<span id="balance_benefit" style="font-size:24px;font-weight:400"></span>
				<span style="font-size:16px;">元</span></div> 
			</div>
			<div style="float:left;width:230px;color:#5f5f5f">
				<div style="font-size:18px;">昨日收益</div>
				<div style="margin-top:10px;">
				<span id="yesterday_benefit" style="font-size:24px;font-weight:400"></span>
				<span style="font-size:16px;">元</span></div> 
			</div>
			<div style="float:left;width:230px;color:#5f5f5f">
				<div style="font-size:18px;">待收收益</div>
				<div style="margin-top:10px;">
				<span id="ready_interest" style="font-size:24px;font-weight:400"></span>
				<span style="font-size:16px;">元</span></div> 
			</div>
		</div>
		<div style="width:700px;height:90px;margin-top:20px;">
			<div style="float:left;width:230px;color:#5f5f5f">
				<div style="font-size:18px;">待收本金</div>
				<div style="margin-top:10px;">
				<span id="ready_amount" style="font-size:24px;font-weight:400"></span>
				<span style="font-size:16px;">元</span></div> 
			</div>
			<div style="float:left;width:230px;color:#5f5f5f">
				<div style="font-size:18px;">累计获取收益</div>
				<div style="margin-top:10px;">
				<span id="already_interest" style="font-size:24px;font-weight:400"></span>
				<span style="font-size:16px;">元</span></div> 
			</div>
			<div style="float:left;width:230px;color:#5f5f5f">
				<div style="font-size:18px;">累计投资金额</div>
				<div style="margin-top:10px;">
				<span id="already_amount" style="font-size:24px;font-weight:400"></span>
				<span style="font-size:16px;">元</span></div> 
			</div>
		</div>
	</div>
	<!--第三栏-->
	<div align="left" style="padding:10px 20px 20px 20px;;width:840px;height:300px;margin-top:20px;background:#FFF;">
		<div style="border-bottom:1px solid #eeeeee;line-height:50px;height:50px;">最近收益</div>
		<div id="mytradelist" style="line-height:50px;">
			<div align="left" style="border-bottom:1px dashed #e0e0e0;height:50px;">
				<div style="float:left;width:200px;"><strong>交易名称</strong></div>
				<div style="float:left;width:150px;"><strong>投资金额（元）</strong></div>
				<div style="float:left;width:190px;"><strong>起息日期</strong></div>
				<div style="float:left;width:190px;"><strong>到期日期</strong></div>
				<div style="float:left;width:110px;"><strong>投资状态</strong></div>
			</div>
		</div>
	</div>
</div>
<script id="mytrade" type="text/x-jquery-tmpl">
	<div class ="pass" pass="${id}" pass2="${status}" pass3="${name}" align="left" style="cursor:pointer;border-bottom:1px dashed #e0e0e0;height:50px;">
		<div style="float:left;width:200px;color:#fa4357">${name}</div>
		<div style="float:left;width:150px;height:50px;">￥${amount}</div>
		<div style="float:left;width:190px;height:50px;">${invest_start_time}</div>
		<div style="float:left;width:190px;height:50px;">${invest_end_time}</div>
		<div style="float:left;width:110px;height:50px;">${status}</div>
	</div>
</script>
<script>
	var url ="#(path)/user/benefit?token=#(session.token??)";
	$.getJSON(url, function(datainfo) {
		console.log(datainfo);
		var userinfo = datainfo.data.info;
		var userinfo2 = datainfo.data;
		$("#mobile").html(userinfo.mobile.substring(0, 3) + "****" + userinfo.mobile.substring(7, 11));
		if(userinfo.is_real_name_verify=="0"){
			$("#is_real_name_verify").attr("src","#(path)/assets/home/account/account_img6a.png");
			$("#is_real_name_verify").click(function(){
				$("#realnamemengban").show();
			});
		}else{
			$("#is_real_name_verify").click(function(){
				layer.msg("您已实名！",{icon:1,time:2000}); 
			});
		}
		if(userinfo.is_bind_bank_card=="0"){
			$("#is_bind_bank_card").attr("src","#(path)/assets/home/account/account_img9a.png");
			$("#is_bind_bank_card").click(function(){
				$("#openaccountmengban").show();
			});
		}else{
			$("#is_bind_bank_card").click(function(){
				$("#changebankcardmengban").show();
			});
		}
		if(userinfo.is_mail_verify=="0"){
			$("#is_mail_verify").attr("src","#(path)/assets/home/account/account_img11a.png");
			$("#is_mail_verify").click(function(){
				$("#changemailmengban").show();
			});
		}else{
			$("#is_mail_verify").click(function(){
				$("#changemailmengban").show();
			});
		}
		if(userinfo.is_set_auth_question=="0"){
			$("#is_set_auth_question").attr("src","#(path)/assets/home/account/account_img8a.png");
			$("#is_set_auth_question").click(function(){
				$("#changeanswermengban").show();
			});
		}else{
			$("#is_set_auth_question").click(function(){
				$("#changeanswermengban").show();
				$("#oldquestion").hide(); 
				$("#newquestion").show();
			});
		}
		$("#is_real_mobile").click(function(){
			$("#changemobilemengban").show();
		});
		$("#is_password").click(function(){
			$("#changepasswordmengban").show();
		});
		$("#all_assets").html(userinfo2.all_assets);
		$("#already_interest").html(userinfo2.already_interest);
		$("#availableAmount").html(userinfo2.availableAmount);
		$("#freezebleAmount").html(userinfo2.freezebleAmount+"元");
		$("#all_assets").html(userinfo2.all_assets+"元");
		$("#balance_benefit").html(userinfo2.balance_benefit);
		$("#yesterday_benefit").html(userinfo2.yesterday_benefit);
		$("#ready_interest").html(userinfo2.ready_interest);
		$("#ready_amount").html(userinfo2.ready_amount);
		$("#already_amount").html(userinfo2.already_amount);
	});
	$.getJSON("#(path)/trade/myList?status=all&token=#(session.token??)&page=1&size=4", function(tradelist) {
		console.log(tradelist);
		$.each(tradelist.data.page.list, function(i, item){ 
			if(item.status=="repaying"){
				var status="还款中";   
			}else if(item.status=="trading"){
				var status="投资中";
			}else if(item.status=="finish"){
				var status="已还款";
			}
			
			var mytradelist = {id:item.bid_id,status:status,invest_end_time:item.invest_end_time,invest_start_time:item.invest_start_time,name:item.name,amount:item.amount};
			$("#mytrade").tmpl(mytradelist).appendTo('#mytradelist');
		});
		$(".pass").click(function(){
			var pass2 = $(this).attr("pass2");
			var idpass = $(this).attr("pass");
			var bidname2 = $(this).attr("pass3");
			if(pass2=="已还款"){
				layer.msg(bidname2+" 已正常还款，为保障借款人信息安全，故不予显示相关信息，还请谅解!",{icon:2,time:1000});
			}else{
				window.open("#(path)/trade-tradeinfo?id=" + idpass);
			}
		});
	});
	
</script>
